var speed = 5.0;
//static var oldyval = 2.0;
var yval = 0.0;
var destPosition : Vector3 = Vector3.zero;

function Update () {
//transform.Translate(-Input.GetAxis("Horizontal")*Time.deltaTime*speed,0,0);

if ( 4.0 > transform.position.y && transform.position.y > 1.0 ) {
	yval = Input.GetAxis("Vertical")*Time.deltaTime*speed;
	//oldyval = yval;
	//Debug.Log(transform.position.y);
} else {
	yval = 0 ;
	if (transform.position.y >= 4.0) {
		transform.position.y = 3.99;
	} else if (transform.position.y <= 1.0) {
		transform.position.y = 1.01;
	}
}
  
transform.Translate(-Input.GetAxis("Horizontal")*Time.deltaTime*speed, yval,0);

//transform.Translate(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
}

function OnTriggerEnter (other : Collider) {
	other.transform.position.y = other.transform.position.y+0.3;
}
 